package com.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.man.UserCtrl;
import com.std.CurrentUser;
import com.std.User;

public class UserDetailAction implements SessionAware{
	private User user;
	private Map  sessionMap;
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public Map getSessionMap() {
		return sessionMap;
	}
	public void setSessionMap(Map sessionMap) {
		this.sessionMap = sessionMap;
	}
	public void setSession(Map<String, Object> session) {
		// TODO Auto-generated method stub
		sessionMap=session;
	}
	public String execute() {
		CurrentUser currentUser=(CurrentUser) sessionMap.get("currentUser");
		if(currentUser==null) return "login";
		UserCtrl userCtrl=new UserCtrl();
		user=userCtrl.getItem(currentUser.getUsername());
		userCtrl.close();
		return "success";
	}
}
